home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2 (Special) / PCPro-2b.iso / Demos / Macromedia / CourseBuilder / CourseBuilderInstaller.exe / Disk1 / data1.cab / Dreamweaver-unInstalled / Configuration / Commands / Paste Interaction.js < prev    next >
Encoding:
JavaScript  |  1999-12-06  |  1.6 KB  |  77 lines

  1. // Copyright 1999 Macromedia, Inc. All rights reserved.
  2.  
  3. //*************** GLOBALS VARS *****************
  4.  
  5. //******************* API **********************
  6.  
  7. //***************** LOCAL FUNCTIONS  ******************
  8.  
  9. function initialize() {
  10.   MM.event.handled = pasteObject();
  11.   window.close();
  12. }
  13.  
  14.  
  15. function pasteObject() {
  16.   var attainDOM, docDOM, newSel, fullSrc, retVal = false;
  17.   
  18.   fullSrc = dw.getClipboardText();
  19.   
  20.   if (fullSrc.search(/<interaction/gi) == -1 &&
  21.       fullSrc.search(/<\/interaction>/gi) == -1) {
  22.     return retVal;
  23.   }
  24.   
  25.   setNewline(); //init NEWLINE global
  26.   
  27.   retVal = true;
  28.   
  29.   if (!regCheck()) {
  30.     return retVal;
  31.   }
  32.     
  33.   if (!siteExists()) {
  34.     return retVal;
  35.   }
  36.    
  37.   // check that the document is saved
  38.   if (!documentSaved()) {
  39.     return retVal;
  40.   }
  41.   
  42.   if (isTemplate() || isDependent()) { 
  43.     if (!hasCBTemplateFix())
  44.       dreamweaver.popupCommand("CourseBuilder Template Fix.htm")
  45.     if (!hasCBTemplateFix()) { 
  46.       window.close();
  47.       return retVal;
  48.     }    
  49.   }  
  50.   
  51.   // Copy support files if necessary
  52.   if (needToCopySupportFiles()) {
  53.     copySupportFiles(true, true, true);
  54.     if (needToCopySupportFiles()) {
  55.       return retVal;
  56.   } }
  57.  
  58.   setBusyCursor();
  59.  
  60.   // create the dom objects
  61.   docDOM = dw.getDocumentDOM();
  62.   attainDOM = new AttainDOM();  
  63.  
  64.   if (fullSrc) {
  65.     newSel = attainDOM.insertSrc(fullSrc);
  66.     if (newSel) {
  67.       docDOM.setSelection(newSel[1], newSel[1]);
  68.   } }
  69.  
  70.   clearBusyCursor();
  71.  
  72.   garbageCollect(true);
  73.   
  74.   return retVal;
  75. }
  76.  
  77.